<?php include ("initsession.php"); ?>
<?php
// create a 100*30 image
header("Content-type: image/png");
$code="";
$_SESSION["securitycode"] = rand(11111,99999);
$code	=	$_SESSION["securitycode"];
$im 			=	imagecreate(60, 18);
// white background and blue text
$bg 			=	imagecolorallocate($im, 235, 235, 235);
$red			=	imagecolorallocate($im, 254, 195, 0);
$textcolor  = imagecolorallocate($im, rand(40,150), rand(0,10), 8);
// write the string at the top left
for($i=1;$i<=3;$i++){
	$red			=	imagecolorallocate($im, 254, rand(50,100), rand(0,255));
	imageline($im,rand(0,60),rand(0,18),rand(0,60),rand(0,18),$red);	
}
//imageline($im,0,5,80,7,$textcolor);
imageline($im,0,8,80,rand(0,18),$textcolor);
//imageline($im,0,14,80,16,$textcolor);
//imageline($im,0,16,80,18,$textcolor);
imagestring($im, 10, 10, 0,$code, $textcolor);
//imagestring($im,15, 5, 1, 17, $textcolor, $font, $code); viet theo font chu
//imagestring($im, 11, 5, 3, $code, $textcolor);
//imagedestroy($im);
// output the image
//header("Content-type: image/png");
imagepng($im);
?>